<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<input type="button" value="按钮" id="btn"/>
<img src="../images/图层133.png" alt="哈哈" title="嘎嘎">
<script>
    document.getElementById("btn").onclick = function () {
        var imgObjs = document.getElementsByTagName("img");
        imgObjs[0].alt = "傻子";
        imgObjs[0].title = "傻帽";
    };
</script>
</body>
</html>